package com.smart.city;

import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;


public class SmartCity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        // Set up click listeners for all the buttons
        View continueButton = findViewById(R.id.sensorView_button);
        continueButton.setOnClickListener(this);
        View newButton = findViewById(R.id.mapView_button);
        newButton.setOnClickListener(this);
        View aboutButton = findViewById(R.id.about_button);
        aboutButton.setOnClickListener(this);
        View exitButton = findViewById(R.id.hide_button);
        exitButton.setOnClickListener(this);
        View loggerButton = findViewById(R.id.log_button);
        loggerButton.setOnClickListener(this);
    }    
        public void onClick(View v) {
        	switch (v.getId()) {
        		case R.id.about_button:
        			Intent i = new Intent(this, About.class);
        			startActivity(i);
        			break;
        	}
        	switch (v.getId()) {
            	case R.id.log_button:
            		Intent j = new Intent(this, com.smart.city.logger.SensorLoggerActivity.class);
            		startActivity(j);
            		break;		
        	}
        	switch (v.getId()) {
        	case R.id.mapView_button:
        		Intent k = new Intent(this, com.smart.city.maps.HelloMaps.class);
        		startActivity(k);
        		break;
        			
        }
    }
        
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;
    }       
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.settings:
    startActivity(new Intent(this, Prefs.class));
    return true;
    // More items go here (if any) ...
    }
    return false;
    }        
        
        
}